@extends('front.common.header')

@section('title', (count($now_cate)>0?$now_cate->cat_name:'热门精华').' - 就业指南')
@section('description',(count($now_cate)>0 && !empty($now_cate->description)?trim($now_cate->description).',':''))
@section('keywords',(count($now_cate)>0 && !empty($now_cate->identify)?trim($now_cate->identify).',':''))

@section('header')
    @parent
@stop
@section('content')
<link rel="stylesheet" type="text/css" href="{{ asset('/css/employ/list.css') }}" />
<link href="{{ asset('/css/company/comdetails.css') }}" rel="stylesheet" type="text/css">
<div class="main">
    <div class="content">
        <div class='top-nav'>
    		<ul>
    		  {!! $mianbaoxie !!}
    		</ul>
    	</div>
    </div>
	<div class="employ-list">
	   <div class="employ-list-left float-l">
	       <div class="employ-search">
	           <div class="search-line" id="search-line">
	               <ul>
	                   <li class="fist-title">学习方向：</li>
	                   <li class="list-nav">
	                       <a href="{{url('/employ/list')}}">就业指南</a>
	                   </li>
	                   <li>
	                       <a href="{{url('/teaches/list/1')}}">充电加油</a>
	                   </li>
	               </ul>
	           </div>
	           <div class="search-line" id="search-line">
	               <ul>
	                   <li class="fist-title">板块分类：</li>
	                   <li  @if($cateid == 0)class="list-nav"@endif><a href="/employ/list">全部</a></li>
	                   @foreach($category as $key=>$cate)
	                   <li @if($cateid == $cate->cat_id)class="list-nav"@endif>
	                       <a href='/employ/list?cateid={{$cate->cat_id}}&sort=0'>{{str_limit($cate->cat_name,8)}}</a>
	                   </li>
	                   @endforeach
	               </ul>
	           </div>
	           @if(!empty($subcateid))
	           @foreach($subcateid as $k=>$sub)
	           <div class="search-line bodertop">
	               <ul class="clearfix">
	                   <li class="fist-title">{{$sub->cat_name}}：</li>
	                   <li  @if($secondid == $sub->cat_id && ($lastid == 0 || empty($lastid)))class="list-nav"@endif>
	                       <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$sub->cat_id.'&sort='.$sort)}}">全部</a>
	                   </li>
	                   @foreach($sub->childrenCates as $key=>$child)
                       @if($key <7)
	                   <li @if($lastid == $child->cat_id)class="list-nav"@endif>
	                        <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
	                   </li>
                       @endif
                       @if($key>=7 && ($lastid == $child->cat_id))
                       <li class="list-nav" >
                           <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                       </li>
                       @endif
	                   @endforeach
                       @if(count($sub->childrenCates)>7)
                       <div class="float-r has-more position-relative" id="has-more">
                           <div class="icon-img">
                               <img src="{{asset('images/front/more.png')}}">
                           </div>
                           <div class="search-line to-more-infomation" style="width:954px;">
                               <ul class="clearfix boderbtm-dashed">
                                   <li class="fist-title">{{$sub->cat_name}}：</li>
            	                   <li  @if($secondid == $sub->cat_id && ($lastid == 0 || empty($lastid)))class="list-nav"@endif>
            	                       <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$sub->cat_id.'&sort='.$sort)}}">全部</a>
            	                   </li>
                                   @foreach($sub->childrenCates as $key=>$child)
                                   @if($key <7)
            	                   <li @if($lastid == $child->cat_id)class="list-nav"@endif>
            	                        <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
            	                   </li>
                                   @elseif($key>=7 && ($lastid == $child->cat_id))
                                   <li class="list-nav" >
                                       <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                   </li>
                                   @endif
                                    @endforeach
                               </ul>
                               <ul class="clearfix">
                                   @foreach($sub->childrenCates as $key=>$child)
                                   @if($key >= 7)
                                   <li @if($lastid == $child->cat_id)class="list-nav"@endif>
                                     <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$sub->cat_id.'&lastid='.$child->cat_id.'&sort='.$sort)}}">{{$child->cat_name}}</a>
                                   </li>
                                   @endif
                                   @endforeach
                               </ul>
                           </div>
                       </div>
                       @endif
	               </ul>
	           </div>
	           @endforeach
	           @endif
	       </div>
	       <div class="employ-search employ-sort mt-15">
               <div class="search-line">
	           <ul class="clearfix">
                   <li class="@if(empty($sort) || $sort ==  0) list-nav @endif">
                       <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$secondid.'&lastid='.$lastid.'&sort=0')}}">综合排序</a>
                   </li>
                   <li>|</li>
                   <li class="@if($sort ==  1) list-nav @endif">
                       <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$secondid.'&lastid='.$lastid.'&sort=1')}}">浏览人数</a>
                   </li>
                   <li>|</li>
                   <li class="@if($sort ==  2) list-nav @endif">
                       <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$secondid.'&lastid='.$lastid.'&sort=2')}}">评论人数</a>
                   </li>
                   <li>|</li>
                   <li class="@if($sort ==  3) list-nav @endif">
                       <a href="{{url('/employ/list?cateid='.$cateid.'&secondid='.$secondid.'&lastid='.$lastid.'&sort=3')}}">收藏人数</a>
                   </li>
               </ul>
               </div>
	       </div>
	       <div class="employ-search mt-10">
	           <div id="main_list">
    	           @if(count($employList)>0)
    	           @foreach($employList as $key=>$emplist)
						@if(!empty($emplist->to_link))
						   <div class="employ-list-inline @if($key > 0) bodertop @else mt10  @endif clearfix">
							   <div class="employ-list-info">
								   <div class="employ-list-img float-l">
									   <a href="/employ/{{$emplist->id}}">
										   <img src="{{count($emplist->attachment)>0?image_resize($emplist->attachment->url,218,132):image_resize('/images/front/pic2-2.png',218,132)}}" width="218" height="132">
									   </a>
								   </div>
								   <div class="employ-list-content float-l">
									   <div class="employ-list-content-title">
										   <a href="/employ/{{$emplist->id}}">{{$emplist->to_link}}</a>
									   </div>
									   <div class="employ-list-content-ext">
										   <img src="{{ asset('/images/front/neweye.png') }}">
										   <span class="color-orange">{{$emplist->reading_num}}</span>
										   <img src="{{ asset('/images/front/newchat.png') }}" class="ml-20">
										   <span class="color-orange">{{$emplist->exts->comment_num}}</span>
										   <img src="{{ asset('/images/front/heart_2.png') }}" class="ml-20">
										   <span class="color-orange">{{$emplist->exts->recommond_num}}</span>
										   <img src="{{ asset('/images/front/clock.png') }}" class="ml-20">
										   <span>{{date('Y年m月d日 H:i',strtotime($emplist->created_at))}}</span>
										   <span class="ml-20"><a href="/employ/{{$emplist->id}}" class="color-green">阅读全文</a></span>
									   </div>
									   <div class="employ-list-content-desc">
										   {{  str_limit(strip_tags($emplist->description),200) }}
									   </div>
									   <div class="employ-list-content-user" @if(empty($authuser)) onclick="loginTips()"@else onclick="message('/message?ruid={{$emplist->user->id}}','{{ csrf_token() }}')" @endif>
										   <img src="{{ userlogo($emplist->user->id,'small') }}">
										   <span style="float:right;font-szie:14px;color:#999;margin-left:10px">作者:{{$emplist->user->name}}</span>
									   </div>
								   </div>
							   </div>
						   </div>
						   @else
    	           			<div class="employ-list-inline @if($key > 0) bodertop @else mt10  @endif clearfix">
    	               <div class="employ-list-info">
        	               <div class="employ-list-img float-l">
        	                   <a href="/employ/{{$emplist->id}}">
            	                   <img src="{{count($emplist->attachment)>0?image_resize($emplist->attachment->url,218,132):image_resize('/images/front/pic2-2.png',218,132)}}" width="218" height="132">
        	                   </a>
        	               </div>
        	               <div class="employ-list-content float-l">
        	                   <div class="employ-list-content-title">
        	                       <a href="/employ/{{$emplist->id}}">{{$emplist->title}}</a>
        	                   </div>
        	                   <div class="employ-list-content-ext">
        	                       <img src="{{ asset('/images/front/neweye.png') }}">
    							   <span class="color-orange">{{$emplist->reading_num}}</span>
    							   <img src="{{ asset('/images/front/newchat.png') }}" class="ml-20">
    							   <span class="color-orange">{{$emplist->exts->comment_num}}</span>
    							   <img src="{{ asset('/images/front/heart_2.png') }}" class="ml-20">
    							   <span class="color-orange">{{$emplist->exts->recommond_num}}</span>
    							   <img src="{{ asset('/images/front/clock.png') }}" class="ml-20">
    							   <span>{{date('Y年m月d日 H:i',strtotime($emplist->created_at))}}</span>
    							   <span class="ml-20"><a href="/employ/{{$emplist->id}}" class="color-green">阅读全文</a></span>
        	                   </div>
        	                   <div class="employ-list-content-desc">
        	                       {{  str_limit(strip_tags($emplist->description),200) }}
        	                   </div>
        	                   <div class="employ-list-content-user" @if(empty($authuser)) onclick="loginTips()"@else onclick="message('/message?ruid={{$emplist->user->id}}','{{ csrf_token() }}')" @endif>
        					       <img src="{{ userlogo($emplist->user->id,'small') }}">
        	                       <span style="float:right;font-szie:14px;color:#999;margin-left:10px">作者:{{$emplist->user->name}}</span>
        	                   </div>
        	               </div>
    	               </div>
    	           </div>
					   @endif
    	           @endforeach
    			   @else
    			   <div class="employ-list-inline">
    			     <div class="employ-list-info">
        			    没有更多数据....
    			     </div>
			       </div>
    			   @endif
			    </div>
			    @if($employ_num > 10)
	           <div class="load-more">
					<a id="pub" href="javascript:void(0)" style="color:white;font-size:18px">继续加载...</a>
					<input type="hidden" name="pages" value="{{$pages}}" />
			   </div>
			   @else
			   <div class="load-more">
			     <span style="color:white;font-size:18px">没有更多数据了</span>
			   </div>
			   @endif
	       </div>
	   </div>
	   <div class="employ-list-right float-l">
	       <div class="employ-list-tips">
	           <div class="tips-title">人气热点</div>
	           @foreach($hots_employ as $k=>$emphots)
	           <div class="tips-content @if($k>0) bodertop @endif">
	               <div class="tips-content-main">
    	               <div class="tips-content-title"><a href="{{url('/employ/'.$emphots->id)}}">{{str_limit($emphots->title,24)}}</a></div>
    	               <div class="tips-content-views">阅读（ {{ $emphots->exts->reading_num }} ）</div>
	               </div>
	           </div>
	           @endforeach
	       </div>
	       
	       @foreach ($ads_img as $key => $adimg)
	       <div class="employ-list-tips mt-10">
	           <img src="{{$adimg->attachment($adimg->id)->url}}">
	       </div>
	       @endforeach
	   </div>
	   <div class="clearfix"></div>
	</div>
</div>
<script type="text/javascript">
    $(function() {
        $("#pub").click(function(){
			var p = $("input[name=pages]").val();
			var cateid = "{{ Input::get('cateid')}}";
			var lastid = "{{ Input::get('lastid')}}";
            var sort = "{{ Input::get('sort')}}";
			$.ajax({
				type:'get',
				url:'/employ/list',
				data:"page="+p+"&cateid="+cateid+"&lastid="+lastid+"&sort="+sort,
				dataType:'json',
				success:function(data){
					if(data.status == 'success'){
						var result = data.data;
						if(result.length >0)
						{
    						var html = '';
    						$.each(result,function(k,e){
    							html += '<div class="employ-list-inline  bodertop">'
    				               	   +'<div class="employ-list-info">'
    					               	+'<div class="employ-list-img float-l">';
    					        if(e.attachment && e.attachment != 'undefined'){
									html += '<img src="'+e.attachment.url+'" width="218" height="132">';
    					        }else{
        					        html += '<img src="/images/front/pic2-2.png" width="218" height="132">'
    					        }
    					               		
				               	html+='</div>'
    					               	+'<div class="employ-list-content float-l">'
    					               		+'<div class="employ-list-content-title"><a href="/employ/'+e.id+'">'+e.title+'</a></div>'
    					               		+'<div class="employ-list-content-ext">'
    					               			+'<img src="/images/front/neweye.png">'
    					               			+'<span class="color-orange">'+e.reading_num+'</span>'
    					               			+'<img src="/images/front/newchat.png" class=\"ml-20\">'
    					               			+'<span class="color-orange">'+e.comment_num+'</span>'
    					               			+'<img src="/images/front/heart_2.png" class=\"ml-20\">'
    					               			+'<span class="color-orange">'+e.recommond_num+'</span>'
    					               			+'<img src="/images/front/clock.png" class=\"ml-20\">'
    					               			+'<span>'+e.publish_time+'</span>'
    					               			+'<span class="ml-20"><a href="/employ/'+e.id+'" class="color-green">阅读全文</a></span>'
    			               			   +'</div>'
    				               		   +'<div class="employ-list-content-desc">'
    			    	                   + e.description
    									   +'</div>'
    									   +'<div class="employ-list-content-user">'
    									   		+'<img src="/images/front/headpic2.png">'
    									   		+'<span style="float:right;font-szie:14px;color:#999;margin-left:10px">作者:'+e.user.name+'</span>'
    								   	   +'</div>'
    								   +'</div>'
    								  +'<div class="clearfix"></div>'
    								 +'</div>'
    							+'</div>';
    						});
    						$("input[name=pages]").val(data.pages);
    						$('#main_list').append(html);
    						
						}
						else
						{
							$(".load-more").html('<span style="color:white;font-size:18px">'+data.msg+'</span>')
						}
					}else{
						$(".load-more").html('<span style="color:white;font-size:18px">'+data.msg+'</span>')
					}
				}
			});
		});
    });
</script>
@stop

<!-- 底部块 -->
@section('footer')
    @parent
@stop